package com.javatip.project.detection.detectionTrainMission.service;

import java.util.List;

import com.javatip.framework.web.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.javatip.project.detection.detectionTrainMission.mapper.DetectionTrainMissionMapper;
import com.javatip.project.detection.detectionTrainMission.domain.DetectionTrainMission;
import com.javatip.project.detection.detectionTrainMission.service.IDetectionTrainMissionService;
import com.javatip.common.utils.text.Convert;

/**
 * 目标检测训练任务 服务层实现
 * 
 * @author 袁伟
 * @date 2024-09-27
 */
@Service
public class DetectionTrainMissionServiceImpl implements IDetectionTrainMissionService 
{
	@Autowired
	private DetectionTrainMissionMapper detectionTrainMissionMapper;

	/**
     * 查询目标检测训练任务信息
     * 
     * @param id 目标检测训练任务ID
     * @return 目标检测训练任务信息
     */
    @Override
	public DetectionTrainMission selectDetectionTrainMissionById(Integer id)
	{
	    return detectionTrainMissionMapper.selectDetectionTrainMissionById(id);
	}
	
	/**
     * 查询目标检测训练任务列表
     * 
     * @param detectionTrainMission 目标检测训练任务信息
     * @return 目标检测训练任务集合
     */
	@Override
	public List<DetectionTrainMission> selectDetectionTrainMissionList(DetectionTrainMission detectionTrainMission)
	{
	    return detectionTrainMissionMapper.selectDetectionTrainMissionList(detectionTrainMission);
	}
	
    /**
     * 新增目标检测训练任务
     * 
     * @param detectionTrainMission 目标检测训练任务信息
     * @return 结果
     */
	@Override
	public int insertDetectionTrainMission(DetectionTrainMission detectionTrainMission)
	{
	    return detectionTrainMissionMapper.insertDetectionTrainMission(detectionTrainMission);
	}
	
	/**
     * 修改目标检测训练任务
     * 
     * @param detectionTrainMission 目标检测训练任务信息
     * @return 结果
     */
	@Override
	public int updateDetectionTrainMission(DetectionTrainMission detectionTrainMission)
	{
	    return detectionTrainMissionMapper.updateDetectionTrainMission(detectionTrainMission);
	}

	/**
     * 删除目标检测训练任务对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	public int deleteDetectionTrainMissionByIds(String ids)
	{
		return detectionTrainMissionMapper.deleteDetectionTrainMissionByIds(Convert.toStrArray(ids));
	}

	@Override
	public AjaxResult startSingleDetectionTrainMission(Integer id) {
		System.out.println("训练任务开始"+id);

		return null;
	}

	@Override
	/*
	   查询自己的目标检测训练任务列表
	 */
	public List<DetectionTrainMission> selectSelfDetectionTrainMissionList(int userId, DetectionTrainMission detectionTrainMission) {
		List<DetectionTrainMission> detectionTrainMissions = detectionTrainMissionMapper.selectSelfDetectionTrainMissionList(userId, detectionTrainMission);
		return detectionTrainMissions;
	}

	@Override
	public List<DetectionTrainMission> selectPublicAndSelfDetectionTrainMissionList(int userId, DetectionTrainMission detectionTrainMission) {
		List<DetectionTrainMission> detectionTrainMissions = detectionTrainMissionMapper.selectPublicAndSelfDetectionTrainMissionList(userId, detectionTrainMission);
		return detectionTrainMissions;
	}

}
